# XFAIL: system-windows
# Darwin uses the legacy behavior of reporting abridged ftag value,
# it is covered by TestRegisters.py::fp_special_purpose_register_read.
# XFAIL: system-darwin
# REQUIRES: native && target-x86_64
# RUN: %clangxx_host -g %p/Inputs/x86-fp-read.cpp -o %t
# RUN: %lldb -b -s %s %t | FileCheck %s
process launch
# CHECK: Process {{.*}} stopped

# fdiv (%rbx) gets encoded into 2 bytes, int3 into 1 byte
expression (void*)($pc-3)
# CHECK: (void *) $0 = [[FDIV:0x[0-9a-f]*]]
expression &zero
# CHECK: (uint32_t *) $1 = [[ZERO:0x[0-9a-f]*]]

register read --all
# CHECK-DAG: fctrl = 0x037b
# CHECK-DAG: fstat = 0x8084
# CHECK-DAG: ftag = 0xea58
# CHECK-DAG: fop = 0x0033
# CHECK-DAG: fip = [[FDIV]]
# CHECK-DAG: fdp = [[ZERO]]

# CHECK-DAG: st{{(mm)?}}0 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0x00 0x40}
# CHECK-DAG: st{{(mm)?}}1 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3f 0x00 0x00}
# CHECK-DAG: st{{(mm)?}}2 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
# CHECK-DAG: st{{(mm)?}}3 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80}
# CHECK-DAG: st{{(mm)?}}4 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xff 0x7f}
# CHECK-DAG: st{{(mm)?}}5 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xff 0xff}
# CHECK-DAG: st{{(mm)?}}6 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xc0 0xff 0xff}
# CHECK-DAG: st{{(mm)?}}7 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}

# legacy approach, superseded by fip/fdp registers
expression (void*)($fiseg*0x100000000 + $fioff)
# CHECK: (void *) $2 = [[FDIV]]
expression (uint32_t*)($foseg * 0x100000000 + $fooff)
# CHECK: (uint32_t *) $3 = [[ZERO]]

process continue
# CHECK: Process {{[0-9]+}} exited with status = 0
